#include <buola/gui.h>

#include <buola/widgets/ctheme.h>

#include <buola/widgets/clabelbox.h>

namespace buola { namespace gui {

CLabelBox::CLabelBox(const std::wstring &pCaption)
    :   mCaption(pCaption)
{
    SetStyle(LBL_LEFT);
    get_default_theme()->SetBackground(this);
}

CLabelBox::~CLabelBox()
{
}

void CLabelBox::SetCaption(const std::wstring &pCaption)
{
    mCaption=pCaption;
    Refresh();
}

///////////////////// Event handling //////////////////////

void CLabelBox::OnExpose(const CExposeEvent &pE)
{
    get_default_theme()->DrawLabelBox(pE.mGC,this,CTheme::DRAW_NONE);
}

void CLabelBox::OnStyleChanged(TStyle pOld)
{
    int lChange=pOld^GetStyle();
    
    if(lChange&STYLE_DISABLED)
    {
        Refresh();
    }
    if(lChange&STYLE_FAKE)
    {
        if(GetStyle(STYLE_FAKE))
        {
            SetInputMode(EInputMode::MOUSETRANSPARENT);
        }
        else
        {
            SetInputMode(EInputMode::NORMAL);
        }
    }
}

/*namespace gui*/ } /*namespace buola*/ }
